package com.pro.service.imple;

import com.google.gson.Gson;
import com.pro.mapper.JsPeopleUnsealingLogMapper;
import com.pro.pojo.JsClosure;
import com.pro.pojo.JsUnseal;
import com.pro.service.JsPeopleUnsealingLogService;
import com.pro.utils.RedisCache;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * ClassName:JsPeopleUnsealingLogServiceImple
 * Package:com.pro.service.imple
 * Description:
 *
 * @Date:2021/12/4 17:18
 * @Author: XJR
 */
@Service
public class JsPeopleUnsealingLogServiceImple implements JsPeopleUnsealingLogService {
    @Autowired
    private JsPeopleUnsealingLogMapper mapper;

    @Autowired
    private RedisCache redisCache;

    private Gson gson = new Gson();

    //查询所有后台人员解封日志
    public List<JsUnseal> SelectPeopleUnsealing(String account, String deptName, String unsealDate, Integer limit, Integer page){
        page = (page-1)*limit;
        List<JsUnseal> jsClosures = mapper.SelectPeopleUnsealing(account, deptName, unsealDate, limit, page);
        redisCache.setCacheObject("JsPeopleUnsealingLogSelect",gson.toJson(jsClosures));
        return jsClosures;
    };
    public Integer countSelectPeopleUnsealing(String account,String deptName,String unsealDat){
        Integer integer = mapper.countSelectPeopleUnsealing(account, deptName, unsealDat);
        redisCache.setCacheObject("JsPeopleUnsealingLogCount",integer);
        return integer;
    };
}
